/* 
 * Program that converts characters like newline and
 * tab  into visible escape
 */

#include <stdio.h>

#define MAXLINE 100

int  max = 0;
char line[MAXLINE];
char newline[MAXLINE];

int getline ();
void copy ();

int main (int argc, const char** argv){
    int length = 0;
    extern int max;
    extern char longest[];

    while ((length = getline()) > 0){   //read an input line from standard of terminal
	if (length > max){
          max = length;                 //storing the longest string
          copy();
        }
        if (max > 0){
          printf ("%s", longest);
        }
    }
    return 0;
}

int getline ()
{
  int c = 0;
  int i;

  for (i=0; i < MAXLINE-1 && (c=getchar())!=EOF && c!='\n'; ++i){
      line[i] = c;
  }
  if (c == '\n'){
      line[i++] = c;
    }
  line[i] = '\0';
  return i;
}

void copy ()
{
  int i;
  extern char line[];
  extern char longest[];
  i = 0;
  while ((longest[i] = line[i]) != '\0'){
    switch (longest[i]){
    case '\n': longest[i] = '\\n';
      break;
    case ' ':  longest[i] = '\\p';
      break;
    case '\t':  longest[i] = '\\t';
      break;
    ++i;
  }
}
